<template>
  <div class="school">
    <h2>学校姓名：{{name }}</h2>
    <h2>学校地址：{{address}}</h2>
    <button @click="getSchoolName">单击获取学校名传递给APP</button>
  </div>
</template>

<script> 
 

export default {
    name:'School',
    props:['receiveSchoolName'],
    data() {
        return {
            name:'北大',
            address:'中国北京',
        }
    },
    methods:{
      getSchoolName(){
        this.receiveSchoolName(this.name)
      }
    }


}
</script>

<!-- scoped 所有的样式只在当前组件的模板中有效 -->
<style scoped>
  .school{
    background-color: skyblue;

  }
</style>
